﻿@model BB.Apostas.ViewModels.RegistoViewModel
<h2>
    Competicoes</h2>
@if (Model.competicoes.Count() > 0)
{
    <table style="width: 50%">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.competicoes.FirstOrDefault().Name)
            </th>
            <th>
                Registar
            </th>
        </tr>
        @foreach (var item in Model.competicoes)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.ActionLink("Registar", "Registar", new { id = item.Id })
                </td>
            </tr>
        }
    </table>
}
else
{
    <h3>
        Nao ha competicoes para registo.
    </h3>
}
<h2>
    Competicoes Registadas</h2>
@if (Model.registos.Count() > 0)
{
    <table>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.registos.FirstOrDefault().Competicao.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.registos.FirstOrDefault().Active)
            </th>
            <th>
            </th>
        </tr>
        @foreach (var item in Model.registos)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Competicao.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Active)
                </td>
                <td>
                    @Html.ActionLink("Eliminar", "Eliminar", new { id = item.Id }) |
                    @Html.ActionLink("Activar", "Activar", new { id = item.Id }) |
                    @Html.ActionLink("Desactivar", "Desactivar", new { id = item.Id })
                </td>
            </tr>
        }
    </table>
}
else
{
    <h3>
        Nao ha competicoes registadas.
    </h3>
}
